package com.tree.backend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tree.backend.entity.pojo.PartyOrganization;
import com.tree.backend.entity.vo.OrgDistributionData;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 党组织基本信息表，记录企业内各级党组织的基本信息 Mapper 接口
 * </p>
 *
 * @author tree
 * @since 2025-10-15
 */
public interface PartyOrganizationMapper extends BaseMapper<PartyOrganization> {

    @Select("SELECT industry_type AS \"name\" ,COUNT(1) AS \"value\",\n" +
            "       sum(party_member_count) AS \"memberCount\" ,sum(employee_count) AS \"employeeCount\"\n" +
            "from party_organization\n" +
            "group by industry_type;")
    List<OrgDistributionData> distribution();
}
